package com.atguigu.pratice;

import java.util.Scanner;

public class StatisticsCharacter2 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String s=scanner.nextLine();
        String str=scanner.nextLine();
        char ch=str.charAt(0);
        int res=0;
        String lowerString=s.toLowerCase();
        String upperString=s.toUpperCase();
        for(int i=0;i<lowerString.length();i++){
            if(lowerString.charAt(i)==ch){
                res++;
            }
        }
        for(int i=0;i<upperString.length();i++){
            if(upperString.charAt(i)==ch){
                res++;
            }
        }
        System.out.println(res);
    }
}
